<template>
    <div>
        <HomeBanner :Arr="Arr"></HomeBanner>
        <div class="center">
            <HomeList :list="list" @onBottom="onBottom"></HomeList>
        </div>
    </div>
</template>

<script>
import HomeBanner from "@/components/Home/HomeBaner";
import HomeList from "@/components/Home/HomeList";
export default {
    data() {
        return {
            Arr: [],
            list: [],
            num: 2,
        };
    },
    components: { HomeBanner, HomeList },
    async created() {
        // console.log(await this.$API.HomeAPI.GetGoodList({ page: 1 }));
        let list = await this.$API.HomeAPI.GetGoodList({ page: 1 });
        this.list = list;
        // console.log(await this.$API.HomeAPI.GetBanner().data);
        let { data } = await this.$API.HomeAPI.GetBanner();
        this.Arr = data;
    },
    methods: {
        async onBottom() {
            // console.log("bottom");
            this.num++;
            let list = await this.$API.HomeAPI.GetGoodList({ page: this.num });
            // console.log(list);
            this.list=this.list.concat(list)
        },
    },
};
</script>

<style>
.center {
    width: 1200px;
    margin: 0 auto;
    /* padding: 20px; */
    padding-top: 10px;
}
</style>